package com.jiyun.controller;

import com.jiyun.pojo.Admin;
import com.jiyun.service.AdminService;
import com.jiyun.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/admin")
public class AdminController {

    @Autowired
    AdminService adminService;

    @RequestMapping("/login")
    public R login(@RequestBody Admin admin){
        return adminService.login(admin);
    }

    @RequestMapping("/updatelevel")
    public R updatelevel(Integer id){
        return adminService.updatelevel(id);
    }

    @RequestMapping("/sendyzm")
    public R sendyzm(Integer yzm){
        return adminService.sendyzm(yzm);
    }

    @RequestMapping("/findAdmin")
    public R findAdmin(@RequestBody Admin admin){
        return adminService.findAdmin(admin);
    }

    @RequestMapping("/register")
    public R register(@RequestBody Admin admin){
        return adminService.register(admin);
    }

    @RequestMapping("/add")
    public R add(@RequestBody Admin admin){
        return adminService.add(admin);
    }

    @RequestMapping("/delete")
    public R delete(Integer id){
        return adminService.deleteAdmin(id);
    }
}
